﻿using System;
using System.Collections.Generic;
using System.Text;
using DevExpress.Persistent.Base;
using DevExpress.Persistent.Validation;
using DevExpress.Xpo;
using DevExpress.ExpressApp.DC;
using DevExpress.ExpressApp.SystemModule;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.ConditionalAppearance;

namespace DomainComponents.XCRM {
    [NonPersistent]
    public class CloseQuoteParameters {
        public CloseQuoteParameters(IQuote quote) {
            this.CloseDate = DateTime.Now;
            this.Status = QuoteStatus.Canceled;
        }
        public DateTime CloseDate { get; set; }
        public QuoteStatus Status { get; set; }
    }

    [DomainLogic(typeof(IQuote))]
    public class QuoteCloseLogic {
        public static void Close(IQuote quote, CloseQuoteParameters parameters) {
            quote.Status = parameters.Status;
            quote.ClosedOn = parameters.CloseDate;
        }
    }
}
